package com.example.yunbiji0314.dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import com.example.yunbiji0314.pojo.Category;

import java.util.List;

public interface CategoryDao {
    //根据用户id查文章类型
    List<Category> findByUserId(Integer id);

    //添加文章类型
    @Insert("insert into category(category_name,category_alias,create_user) values(#{categoryName},#{categoryAlias},#{createUser})")
    int add(Category category);

    //删除文章类型
    @Update("update category set deleted = 1 where id = #{id}")
    int delete(Integer id);

    //查询文章详情
    Category findById(Integer id);

    //查询文章类型
    @Select("select * from category where create_user = #{id} and deleted = 0")
    List<Category> selectleixingId(Integer id);

    //查全表
    @Select("select * from category")
    List<Category> selectAll();
}
